//
//  DetailsofthebillViewController.m
//  Park
//
//  Created by 123456 on 2017/11/29.
//  Copyright © 2017年 YTYangK. All rights reserved.
//

#import "DetailsofthebillViewController.h"
#import "DetailsofthebillViewModel.h"

@interface DetailsofthebillViewController ()

@end

@implementation DetailsofthebillViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    
    [self updat];
    
}


-(void)updat{
    
    
    NSDictionary *dic = @{@"token":[NSUD objectForKey:@"token"],@"id":self.idstr};

    
    [DetailsofthebillViewModel requestWithUrlForDetailsofthebill:self andParam:dic success:^(NSMutableArray *model) {
        
        
        for (NSDictionary *dic in model) {

            self.Titlelabel.text = dic[@"orderType"];
            self.Expenditurelabel.text = [NSString stringWithFormat:@"-%@.00",dic[@"expenditure"]];
            self.PaymentMethodlabel.text = dic[@"payMent"];
            self.CommodityDescriptionlabel.text = dic[@"description"];
            self.datelabel.text = dic[@"operateTime"];
            
            self.OrderNumberlabel.text = dic[@"customerOrderNub"];
            
            
            if ([dic[@"orderStatus"] isEqualToString:@"进行中"]) {
                self.OrderStatuslabel.textColor = RGB(40, 130, 60, 1.0);
                self.OrderStatuslabel.text = @"订单处理中";
                
            }else if ([dic[@"orderStatus"] isEqualToString:@"已完成"]){
                self.OrderStatuslabel.textColor = [UIColor grayColor];
                self.OrderStatuslabel.text = @"交易成功";
                
            }else if ([dic[@"orderStatus"] isEqualToString:@"已取消"]){
                self.OrderStatuslabel.textColor = RGB(193, 33, 71, 1.0);
                self.OrderStatuslabel.text = @"交易取消";
                
            }
            
            if ([dic[@"orderType"]isEqualToString:@"预约专车"]) {
                self.Orderimage.image = [UIImage imageNamed:@"车辆"];
                self.BillingClassificationlabel.text =[NSString stringWithFormat:@"%@-专车",dic[@"classifyName"]];

            }else if ([dic[@"orderType"]isEqualToString:@"预约订餐"]) {
                self.Orderimage.image = [UIImage imageNamed:@"餐厅"];
                self.BillingClassificationlabel.text =[NSString stringWithFormat:@"%@-餐厅",dic[@"classifyName"]];

                          
            }else{
                
                

                
            }
            
            
            
            
        }
        
        
        
    } failure:^(NSString *error) {
        [MBProgressHUD showError:error toView:self.view];

    }];
    
    
}



@end
